export { default as App } from './app/App';

// 开放第三方能力
export { default as printJS } from 'print-js';

// 动态加载所有页面
const module_pages = require.context('./pages', true, /\.js$/);
const pages = module_pages.keys().reduce((pages, path) => {
  const name = path.replace(/^\.\/|.js$/g, '');
  pages.set(name.replace(/\/|\\/g, '.'), module_pages(path).default);
  return pages;
}, new Map());
export { pages };

export { theme } from './config';
export { default as alert } from './utils/alert';
export { default as client } from './utils/client';
export * as cookie from './utils/cookie';
export * as ext from './utils/ext';
export * as sound from './utils/sound';
export { default as tree } from './utils/tree';

export { default as About } from './components/About';
export { default as AntdCharts } from './components/antdCharts';
export { default as Attachments } from './components/Attachments';
export { default as EditableTable } from './components/EditableTable';
export { default as FillTable } from './components/FillTable';
export { default as FillTabs } from './components/FillTabs';
export { default as Iconfont } from './components/Iconfont';
export { default as Iframe } from "./components/Iframe";
export { default as InputNumberRange } from './components/InputNumberRange';
export { default as PDFViewer } from "./components/PdfViewer";
export { default as DropdownSelect } from './components/DropdownSelect';
export { default as PopupSelect } from './components/PopupSelect';
export { default as RichTextField } from './components/RichTextField';
export { default as SearchTable } from './components/SearchTable';
export { default as SelectTable } from './components/SelectTable';
export { default as UploadField } from './components/UploadField';

export { default as useDrawer } from './components/useDrawer';
export { default as useModal } from './components/useModal';

export { default as Page } from './app/Page';
export { default as MetaPlatformComponent } from './app/MpComponent';
export { default as MetaPlatformForm } from './app/MpForm';
export { default as MetaPlatformPage } from './app/MpPage';

// 本地调试模式下，加载所有元数据页面
const metadata = new Map();
if (process.env.NODE_ENV === 'development') {
  const module_pages = require.context('../pages', true, /\.(mppage|mpform)$/);
  module_pages.keys().forEach(path => {
    const name = path.replace(/^\.\//g, '');
    metadata.set(name.replace(/\/|\\/g, '.'), module_pages(path));
  });
}
export { metadata };